package com.puzzlebazar.client.puzzleinfo;

import com.puzzlebazar.client.main.control.TabbedSubstate;
import com.puzzlebazar.client.main.view.TabbedView;


public class DetailsSubstate extends TabbedSubstate {

	public static final String TAB_NAME = "Details";
	public static final String STATE_NAME = "Details";

	private final PuzzleInfoModel model;

	private PuzzleInfoView puzzleInfoView = null;
	
	public DetailsSubstate( PuzzleInfoModel model, TabbedView view, PuzzleInfoController controller ) {
		super( view, controller );
		
		this.model = model;
	}

	@Override
	public String getTabName() {
		return TAB_NAME;
	}

	@Override
	public String getStateName() {
		return STATE_NAME;
	}

	@Override
	public void enter() {
		super.enter();

		if( puzzleInfoView == null )
			puzzleInfoView = new PuzzleInfoView( model, (PuzzleInfoController)controller, controller );
		
		view.setMainWidget( puzzleInfoView );
		
		
	}

	@Override
	public void exit() {
		super.exit();
	}

	@Override
	public void release() {
		super.release();
		if( puzzleInfoView != null )
			puzzleInfoView.release();
		puzzleInfoView = null;
	}

}
